﻿namespace Sidvall.FileSystemManager.Net.Services.V1
{
    public sealed partial class RenameConfig
    {
        #region Deserialize

        public static RenameConfig Deserialize(string value)
        {
            Sidvall.FileSystemManager.Net.Services.V1.RenameConfig dataItem;

            try
            {
                if (!string.IsNullOrWhiteSpace(value))
                    dataItem = Sidvall.Serialization.SerializerManager.Current.Deserialize<Sidvall.FileSystemManager.Net.Services.V1.RenameConfig>(value);
                else
                    dataItem = null;
            }
            catch
            {
                dataItem = null;
            }
            if (dataItem == null)
            {
                dataItem = new Sidvall.FileSystemManager.Net.Services.V1.RenameConfig()
                {
                    RenameConfigId = 1,
                    FolderPath = "** PATH TO ROOT FOLDER **",
                    OldName1 = "XXXXX",
                    OldName2 = "YYYYY",
                    OldName3 = "",
                    NewName1 = "Company.Product",
                    NewName2 = "Product",
                    NewName3 = "",
                    SearchPatterns = CodeManager.SearchPatterns,
                    RenameFolders = true,
                    RecursiveFolders = true,
                    RenameFiles = true,
                    UpdateFileContents = true,
                    CaseSensitive = true,
                };
            }
            return dataItem;
        }

        #endregion
    }
}